# coding: utf8

import os

# this should get written to a config file
_plugin_admin_installed = True

def _ensure_configuration_file(configuration_file_path):
    if not os.path.exists(configuration_file_path):
        our_file = open(configuration_file_path,"w")
        our_file.close()
#        print('created %s' % configuration_file_path)
#    else:
#        print('found %s' % configuration_file_path)

def _ensure_configuration_file_append_global(configuration_file_path, configuration_file_global, plugin_name):
    if not os.path.exists(configuration_file_path):
        _ensure_configuration_file(configuration_file_path)
    if configuration_file_global not in globals():
        our_file = open(configuration_file_path,"a")
        our_text = '# append requested by %s \n' % plugin_name
        our_text += '%s = True' % configuration_file_global
        our_text += '\n'
        our_file.writelines(our_text)
        our_file.close()
